slightly better algorithm for locator but buggy for dotplot