Update task factory to use traits