add generic update loop