Add write all function