FYI, instead of doing the distance calculation by hand, you can subtract one Vector3 from another and then use its Length method to find the distance. That's part of what's included in this refactor.