better way to do multi-statement write