Improved Sequence<T>'s efficiency

Added type parameters, and removed tons of type checks. Significantly
increased performance of Set, Insert, Split...