Part1: Refactor of TrackEncoder

Re-based to latest m-c.