(no logic change) renamed variable
Fixed Detection position adjustment
Multiple optimizations (especially in multi-threaded context)