Compatibility with ghc < 7.7.
Clean up type signatures and other small things.