Small refactor of update code