code tidying up