remove unneeded matrix multiplication