Votes refactoring

**Work in progress, not to be merged just yet.**