Flatten BT iterative