inline flatMap (trial and error)