reordered write arguments to be more consistent