refactor update neighbors helper method