Handle query string