Make a start on porting diff from python to C