What does こと refer to in だけのことはある


I'm trying to figure out what "こと” is referring to in this idiom/grammar
point.

In the following example sentence:

彼は若いころから日本に住んでいただけのことはあって、さすが日本語がうまいんだね。

What does koto refer to here?

Additionally, is this perfectly interchangeable with だけあって

Compare the following 2 sentences

彼は若いころから日本に住んでいた **だけのことはあって** 、さすが日本語がうまいんだね。  
彼は若いころから日本に住んでいた **だけあって** 、さすが日本語がうまいんだね。

Are these different? If so, why?




I think `こと` just refers to the general situation, and does not refer to some
particular thing. A close English analogue may be `the case` as in `It is the
case that he was living in Japan`. Your two sentences with and without `こと`
are interchangeable.

