Tidied up comments and code