Refined update function

Refined update function