Rewrite of decoding