Refactoring the D code generator to make it more modular.