Added solution for part 3 of the assignment