renamed the generate cookie function