Rewrote cursor handling logic

Upgraded celery