more tests, added envelope functionality