Remove global references to map objects to make code more modular