Remove code redundancies and add new variant.

Several modules follow a pattern where we have a template of common
parts and changes with some variation in one or two spots. I used the
child() mechanism to factor out the templates.

Added a change to the C variant to generate D. This one has grooves in
the corners instead of being more rounded.
Factor out point definitions.