This is the OOP version of the code