Added code for Task 3 Part 2 and 3