Some speed improvements in haskell #3