adds leaves functionality
merge conflict