small refactor on rootScope
fix conflicts
add tests
Merge pull request #738 from matiu/bug/unitname

Bug/unitname
optimize redeemscript map generation
add tests for Structurewq