Changed to use cookies and turned off debugging
Rather than by global variable