Made small optimization to matrix multiplication