more refactoring for structure and profit