Implement update function.