enhanced update function