Renamed resp to response and minor refactor