add error condition
modified response building function
add error