Added functionality to make connections with distance
Added necessary functionality