Refactors the factory to return tasks.