Full implementation and fixes to the AIS.