When checking the distance, make sure to use the square - that's faster.