Added pickling and output pickle