fold version
rewrite monad