factor out ITree and reimplement --species-count