New solution in part 2 + commented a plot