Refactoring the optimization step into a celery task, as it is now more costly.