performance improvement for large trees, based on cintimedia suggestion