added getlinks function