Id clashes could be prevented completely if existing ids are prefixed with `X` and generated ids prefixed with `Y`. That way they are automatically in different namespaces and can no longer clash.