NearBy code & testcase