Replaced Control.Monad.Error (depricated) with Control.Monad.Trans.Except as suggested.