first round cleanup of server code