Centralize code generation a bit more