Updated algorithm for tap detection on lines.