Add output loop counter
Add rig struct