Re-implement the program using OOP