implemented minimumpath, stuck after second click