simplify the monad implementation a bit