Changed the order of the types in the substitution optimization. Now it is more likely to produce better optimizations.