Backport of semantic type support from 0.6

Backported the semantic types support on top of the 0.4.1 release