Object Oriented version (still working on a couple of minor bugs)