writing out intermediate results