refactoring samples