Changing code for OOP