Refactored the code after being unable to run some of the tests on private methods. Looks tidier now.