Tasks: decreasing code complexity of tasks controller