added clear_file function