pseudocode for Update