Tidied up, added more tests and main() test class