adjusted for i = j, when the arrays are different it's very important to include those