changed to an OO paradigm, added more solution code