now writes intermediate results