Refactored github api helper code