Task 3 code