Added saving and pretty-printing of output