Speed up the calculation by reducing the number of memory allocations.
Its now 2x faster for a term with 26 different variables (~67 million combinations).