renamed to RESP, and cleaned up code