Added some serious unit testing. Refactored classes to be able to unit test (injections), plus fix one or two bugs found by unit testing (yay!)