minor tidying up
improved tidy-up from branch