simplified structure tree

the structure tree has been reworked and the code is now much more compact.