refactored createFolder code out of main method