example 1.5 + refactoring