First version of the save algorithm
Leaflet integration WIP