Small simplification: Reduce the use of cast<>.