Tidying and minor fixes