Exercise 4.6 flatMap resolved