minor tidy up of code