Refactoring and adaptive thresholding feature