version with recursive transitive closure as in dic, improved debug output