reversed expression logic in validateDistance() to make it more understandable