refactor out method from Task