fixed envelope design, cleaning up some code.