Extracted update functionality.