Put the code in to OOP format