fixes and tidying up