refactored update update logic