Refactoring to make JS call externally so we can modify Leaflet; not done yet