update function working