Not sure what I should use for "when"?
If you use the adjectival '的', then it has to be '当我回家的时候' (at the time I come home) - 时候(time/ moment) is a noun

If you don't use the adjectival '的' then you can write '当我回家时' (when I come home) - 时 (when) is an adverb

当我回家的时候 = at the time I come home

当我回家时 = when I come home

当我正在回家的时候 = during the time I was coming home

当我正在回家时 = when I was coming home