Improved Node allocation logic.