more refactoring, more modular