Decode function added. Not working yet