add prepareTasks function