update loop function