refactoring to be OOP (and therefore more maliable)