beginnings of the diff function