cleaning up server code