Modified codes for PR