Minor changes to response construction and error handling.