Code tidyup, remove a few unnecessary cast checks.