removed leaf function