bit more refactoring