refactored p2_main.cpp a little. wanna check memory leaks in code, then submit