Refactored how auto-tree selection works.