Modification for latest Pangoin. Compiled well on Mac with Clang.