Some refactoring of CMT

- a lot of code cleanup
- added MappingTracker class, extends CMT tracker with mapping logic