move pm functions to class file