further code tidying up