Implement updated scanned_file

And tests.