Added MaxWaitLoopCount setting and behavior