added a geometric difference function