Solving part 4