Added a check for query string