optimized voting algorithm