wrote decoding method