Commented and cleaned up main template.