Refactored client-side code

Now it's pretty with functions. Also added upvote/upvote(s) dependent on count, as well as changed up upvote/downvote color.