Fixing inconsistencies in templates and adding code for backwards compatibility.