added interm
added intermediate results saving