typo in the error message, added test for withinDistance