A bit more refactoring