refactored neighbors joining method