improve the mechanism to calculate available number