Add scanFile() Function

This should increase code readability of the patch.