Added logic for tasks