Moved map initilization into function