Refactored code. Optimized specifically for election proposals.