Fix #1 bug and added parse cookies

http://misko.hevery.com/code-reviewers-guide/flaw-brittle-global-state-singletons/