Adding geofence algorithm code.