Added code for Task 3 Part 1 and 2