Basic serialization handling. Might be moved to an extension