Added some geometric math.