switched to a for-in loop in tree.dart