Use urlencode and urlunsplit rather than quote/unquote and string interpolation