envelope.py cleanup
optimization of update_data