update def write (to be continued)