clean up server code