Optimize backtracking in links
Add more tests

+ a benchmark case