Refactored Server  functionality out
Tests changed to match new structure
Extracted helper methods