Simplfied main task loop.