Tidying up of error messages and tests