Clear up loose ends.
Simplify template code.