REFACTORING CODE