Add flatten that doesn't use flatMap