refractor of how folders are generated