Added the check for files existing