Refactor github integration