added sudo to pm function