Refactored cleanLineNoise with new parameters