Extract internal decoding function to its own, to avoid invoking it each time.