Using temporary pickle to debug. Refactored lambda expressions used in history. Refactored problematic Opt.