refactor p2