url query string constructing refactored