Rough draft of complete server, have not tested it yet