Use traverse to handle $type/$data