Works except for menu generation
Use tree as data structure now!
Removed unused code and debug output