fixes and tidy up