Added global $link;