Generalizing diff API