Add tree flatten