splitting stuff into better modules, adding haddock