Refactored monad to use Error transformer