Added log out functionality. Fixed intermittent counter bug.

Fixed the bug where counter values would randomly not appear.