Better voting algorithm