Added validation for adding a task