Finish refactoring Server logic