some tidying up of return values