Adding binary search and fixes on index search