Some minor improvements.

Mainly removed duplication in the templates.