fixed refactor of query string extraction.