binary search
minor corrections