Modified to OOP, refactor in progress