adding other field to api and improving error checking