Added a comparator that compares elements by Y coordinate.