created common outputresponse function