Fixed the dislocated displacement bug. (searching for x index in y array and vice versa)