improving casting example