It's good that it sounds clumsy to you, that means you're developing an intuitive understanding of the language. Как раз когда - just when..., как раз - just then. In Russian "when" is a sign of a subordinate clause. I don't know if it helps clear things up for you. I don't like my original explanation and have been trying to think up a better one.