A lot of refactoring to make the vertx bits stand out more. Add an election hack