implemented binary search
merged resolution