Updating p2 with js