Refactor Server, reduce complexity