Updated type coercion to include subtypes