Adds support for spaces in query

Now you can have spaces on the end of the query and still get results.