Variable and Distance Calculation