Wrote Task 2 code