Task1 and Task2 code