refactor p1