Move the envelope code outside the useless envelope module.