Some major template improvements