extracted a helper function to get query string params