add option to plot final result
debug