Performance improvements for cached results and building query strings.