Allow deletion on the map namespace

Note there seems to be a bug in leaflet which prevents deletion
of elements in existing maps.
Reshuffle code