Generalize reponse handling