Refactor StringDecoder