added transitive closure calculatioin