Start of neighbor join code