Refactored github PR handler