param: Correctly create directory and create common function.