updated for charachter decoding