update matchElement function