Moving authenticity token addition outside of the loop