Avoid creating global variables 'match' and 'map'