Changed function signatures to return number of neighbors found