refactoring with oop