even more refactoring