Bug Fixing

Change some OOP design to fix a few bugs