refactor source check