Implementation of update.