Copied functionality from election-viz