solution 11: minor refactoring