more code tidying