Added nested state controller
Initial refactor