Refactored server
Refactored serialization