boilerplate code for sending data back to host