Refactoring the tasks