Better query string detection