added buildQueryString function