Tidied up some of the codebase