adding if else to pair response.type with response.code
spelling error