Moved code to OOP