Working Gdc method, trying to implement in main