removed duplicated code in pm.js