Modified Factor Exhaust to matrix multiplication rather than for loop, moved new sudan Q function to original