Task support refactoring, bug fixes