PIM-SM functions

PIM-SM functions in three phases: