Refactored the serialization code to make it easier to maintain.

-- All the key defaults are now centralized.