fixed bugs in approach and search. need to test and tune
Merge branches 'version3' and 'temp6' into version3