rewrote find_link_lengths to try and reduce ridiculous memory usage- changed from all variables to just 1