refactored code which created dir structure
refactored code for dir structure