Improve querystring calculation and hint insertion