implement write