Some template cleanup (coding-wise, not markup-wise)