Moving functions to pm-common.pl