refactor Decode method to use static dictionary lookups. This simplifies
the logic and removes nested switches.