had a comparision comparing the wrong direction