Added logout to clear cookies and maintain state