Clean up serialization on the server

also add preparation material for sending stuff back to the client