Refactored serialization, refactored many things