This code makes no sense to me.
rel seems to be a hash, you set one of the keys of the hash to itself
then you check if it exists which would have blown up before.