Adding cookies and more functionality