Some tidying of the code gen module