Handle cookies
cleaned up pull request code.