Finished the neighbors function