Refactor Server to be more conducive to multi-threading