Big rewrite of almost all functions

Rewrite of workers, tools and changing to Leaflet 0.8-dev