a little bit more refactoring