Refactor and add ExceptT instance