refactor task controller