Added feature: Detect loss of track.
Spacing and code cleaning.