Rfc6810 bis

pull request for reviewing code
are these tmp variables really necessary? I would guess it also works without them