Envelope refactoring