Tidy up and minor fixes