Use hasChildren method to fix perf issues
Merge pull request #3 from marmelab/use_has_children

[RFR] Use hasChildren method to fix perf issues