Refactor treebrowser
Bug fixes