Added urlencode for query