Got encode/decode working
Moved values to global