Added tree traversal func to the class.