implemented the Error Monad and added tests