update loop s logic and support engine shutdown