solution to p2 added