moved assigning cookie function to a template
merge conflict