rewriting using new pnode