simpler way to encode and decode | ScratchStats