refactoring for better haddock output