refactored tree code
changed comments in revealing panel to prevent errors