added error messages to votes and cleaned up js logic