refactoring sample for comparison