* bunch of refactoring and added some unit tests - still incomplete
Major refactor and rounding out of unit tests.  Considering this the first usable version.