Adding host function calls to get nearest neighbor