Simpler casting and more checking.