still some more refactoring