Relocate querystring parsing logic