Refactor envelope into a struct
Add COPYING file