formatting data to send back to client