Added P loop