Remove extra space.
Split some code into another module.
Add comments separating both halves of the server.
Remove dead code.