[WIP] Refactor MSM

Is it possible that `self.mapping` and `mapping` could get out of sync and not correspond to the same integer states?