implements update logic