reducing the number of http calls per query