NumAvailUnits is 1 based, so corrected code