added some visualization and some searching loops for automatic adjustment of scale and neighbors