Refactored and added functionality to server.py, updated test cases in test_server.py