Classic protocol and crypto cleanups.

It's more clear to me this way, I'll keep it since it concerns a corner case.