corrections and tidying up