Made a better cookie implementation