code refactoring and OOP