Removed superflous terms from get_neighbor function.