Finished server (mostly untested)