Merge some code form MyTracks, TBC.