refactoring to true OOP code