Replaced flatten with flatMap