Clone of Ryan's Git to implement the algorithm