Modified the way in which injection happens in CodeGenerator and a TestMain