Replaced file_exists calls with is_file