Added smart track length calculation