updated api response handling.