Refactored maxconcurrency mechanism.