Refactored the simple types handling.

New approach has one function per type, all having
the same signature, so that they can be used in a
map of functions.