Optimalized code. Now returns dictionary of all links. Too see the
result, uncomment marked lines.