Added a host of debugging statements for pickling, unpickling (__getstate__ and __setstate__)