Added option to save interim result