updated logic to handle pr