Checks if ReferenceFile is indexed, and if so, uses it

added tests.

removed part that would allow Random access