changed code to support leaflet and google maps