Made range search more efficient for mydbtest2.py