Exported CheckFile and added test for it.