improve voting logic