Refactoring

we should probably change that else if (metadata.leader() == null) {