Solve cyclic references

The id property could be used (which already is the hash of the path) to make this even faster