A small refactor for tasks. But could do more I guess.