#8: more refactoring