remove javascript references to cookies and place in controller