Imported from https://github.com/seung-kim/pmn_demo