Add signal handling to p2