completed conversion to OOP, cleaned up code and fixed the Makefile for OS X