Amended to use bulk write