wrapping up hierarchical state support
Cleaning up all logic and code.