Added error checking for references that reference the same file along
with 3 tests,