converted to OOP