simplified and inlined `resp` logic