Break up of Types api and make encoding result configurable.

Refactored types api to breakup serialization and normalization pieces. The encode type is also generic to allow for more specialized encoding types.

This is to address Issue #27