I wonder if it's possible to restructure the code to have separate loops for skipping over a word and skipping runs of whitespace. You might be able to get rid of the need to decode that way, perhaps?