Adding security to map generation code