refactor for better OOP