When I
woke up this morning, it
was snowing.
I was sleeping when you called me.
I broke my leg when I was hiking.
Can you see a difference in the meaning of these two sentences?
When the guests arrived, Jane was cooking dinner.
When the guests arrived, Jane cooked dinner.