Fixes #346
Fixes #273. Fixes #350
Added API method to retrieve defined types. Fixes #345