Changes for unit testing

Signed-off-by: Michael Greenhill <doctorjbeam@gmail.com>
Bugfixes

Signed-off-by: Michael Greenhill <doctorjbeam@gmail.com>