Changed StateSet to StateTree. Added visitors as a way to operate with
the tree.