Actually hopefully works
I used @griffpatch's scripts to encode and decode variables. Everything else was by me.