made it faster

used binary search.