Refactoring to ease the way we define generated code

Let's make it easier to define generated code via template. The approach is to use moustache template.