Improved the haskell implementation for the DM1.