Change line tracking algorithm