optimize 'change cell neighbors' matching