Finished code for p1. About to test