add select-run-messages and a monad