cleaning up the server code