added validation cookie and template helper function