refactored github connection with Struct