Created main test units and finished testing Stats

Some refactoring to test it properly.
Finished Stats test but pretty much everything else needs testing.