Improve update loop logic.