option to collect only leaf nodes