Update functions and loop