added custom wcount_neighbors function