work on refactoring tree
fix resolve references in statemap