added dispatcher, restructured election code