refactoring p1