sample refactoring