minor tidying of code