Clean up enum serialization code