added logging, pickling