Geofence rewriting with angularjs imporvements