Finished first sort method, working on gerSortedEndPoints.