simplified flatMap