implementing response handler