Refactored PR-generation