introducing callback function to pass response to client-side