refacotring of haskell client