Refactoring code example