Enhance inferring algorithm.