Refactor celery module