refactoring the task module