Task 2 code