create directory refactoring