Tasks refactor