Added waiting to fix rate limit issue, and some other small changes.