restructuring. add basic validation for tasks.