Moving serialization to outer package