Okay, I made a diagram. Now it actually works.

(Though has some security flaws, I imagine)
I'll go add the diagram...