Added all checks.
Modified to support file or URL