Added flags based serialization