improvement to query string parsing