second example and related refactoring