implemented cookie to store votes between refreshes, and some refactoring