Implemented dynamic back buttons in each template.