Added check for file_exists