Improvements to generated code when inhomogenous channel density present