Refactored some code into checkRateLimit().
Added in cursor support.