Refactor dojo code generation