Tidy up repeat field rendering logic (and associated field templates)