refractor of checkforfile