refactored response handling to use generic responseHandler by passing in values.