Completed conversion from prodedural to OOP.