creating logic for voting