Alternate codegen sample using multiple choose

This version uses 'choose' blocks inside 'when' blocks
split on a new unit basis. This is more verbose but
should run more efficiently.