Changes to fix decode. Not working yet