Added out_links, corrected some bugs