Fixed p1, fixed some warnings