[P3]Modulizing PM function a bit.