Tidied up refactoring and code coverage