modified to allow full transformation of the response