Rearranged some code. The Haskell module system sucks.
Updated documentation.