Improved map JS and how map legends are rendered.