Added pickle/unpickle functionality.