breaking up queries in order to deal with endpoint timeouts