Change code to OOP