Splits type detection from casting and doesn't require the use of lambdas.