Finish Task2 code