Added part 4 of solution