modularised code generator