fixed comments and spacing, added info about backreferences in templates