Refactor and complete GitHub API implementation