Refactoring

Refactored code. Now uses HTML5 local storage instead of cookies.