Added update and action loop functions