modified get_neighbor()