added urlencode for links with spaces