refactoring sample2