More work on getting types.
Cleanup of casting