Changed distance from double to int.