Stopped using np.matrix, brought back the swap variable.