implement memory writes