Revert "Remove O(n^2) issue in tree importers - fixes #699"

This reverts commit 6b3592982ed60a7c04b8cdf71022a52c82725b60.
fixing bug #799