Code refactoring for tasks

Separation between tasks and task implementations