Change Enumerable.toSeq to use LINQ's Cast<T> extension method.