mostly done with server code