p1.cpp and p2.cpp fully functional