Refactored environ pickling