Refactor DocGenerators to use functions
WIP