more refactoring for new profile dir format