OOP version of program