tidy up and fixes