Refactoring of vote processing

Part of bug 1317554

Change-Id: I6f79025cb86501ae10ab8b63781287781d14ae21