Update logic.