added binary search
added scope and timeout