new config based casting