created universal cookie function