Made the search_for_a_term function url encode and trim the passed query.

When a query is passed to the search_for_a_term() function, the query is now trimmed (white space e.g. spaces tabs and new line characters are removed from either end of the string), and any non alphanumeric characters are now url encoded. :D