map and flatMap working together