cleaned up codebase, fixed haddock generation