Fix tests and start to abstract Envelope