Changed serialization for enum types.

Made comments per Igor's suggestions.