anchor.diff:    return atlasState.placeLayers[p.id];
   };
   
  -atlasJS.updateMetadataPanel = function( ) {
  +atlasJS.updateMetadataPanel = function ( ) {
     $( ".panel" ).remove();
  -  panel = $( "#right" );
  +  var panel = $( "#right" );
     panel.html( "" );
  -  listings_panel = $( "#bottomright" );
  -  listings_panel.html( "" );
  -  var parentWasNotExploded;
  -  _.each( atlasState.selectedPlaces, function( p ) {
  +  var listingsPanel = $( "#bottomright" );
  +  listingsPanel.html( "" );
  +  _.each( atlasState.selectedPlaces, function ( p ) {
       atlasJS.appendPlaceMetadata( panel, p );
  -  });
  -};
  -
  -atlasJS.appendPlaceMetadata = function( panel, place ) {
  +  } );
  +};
  +
  +atlasJS.appendPlaceMetadata = function ( panel, place ) {
     var existing = atlasState.placeLayers[place.id];
     var placeName = place.display_name || place.name;
     panel.append( $( "<h2>" ).text( placeName ) );
  -  if( !existing || ( ( existing.type != "native" && existing.type != "introduced") && existing.type != "exploded" ) ) {
  -    var addPlaceLink = $( "<a href='#'>" ).text( "Add this place" );
  -    addPlaceLink.on( "click", function( e ) {
  +  var addPlaceLink;
  +  if ( !existing || (
  +    ( existing.type !== "native" && existing.type !== "introduced" ) && existing.type !== "exploded"
  +  ) ) {
  +    addPlaceLink = $( "<a href='#'>" ).text( "Add this place" );
  +    addPlaceLink.on( "click", function ( e ) {
         e.preventDefault( );
         atlasJS.alterAtlas( place );
  -    });
  +    } );
       panel.append( addPlaceLink );
       panel.append( "<br>" );
     }
  -  if( existing && ( existing.type == "native" || existing.type == "introduced") ) {
  -    var addPlaceLink = $( "<a href='#'>" ).text( "Remove this place" );
  -    addPlaceLink.on( "click", function( e ) {
  +  if ( existing && ( existing.type === "native" || existing.type === "introduced" ) ) {
  +    addPlaceLink = $( "<a href='#'>" ).text( "Remove this place" );
  +    addPlaceLink.on( "click", function ( e ) {
         e.preventDefault( );
  -      var confirmText = "This will destroy all the listed taxa that are of this taxon (or any descendants)" + 
  -          " for this place (or any standard descendants). This can be very destructive, are you sure?";
  -      if(confirm(confirmText)) {
  +      var confirmText = "This will destroy all the listed taxa that are of this taxon (or any descendants)"
  +        + " for this place (or any standard descendants). This can be very destructive, are you sure?";
  +      if ( confirm( confirmText ) ) {
           atlasJS.alterAtlas( place );
         }
  -    });
  +    } );
       panel.append( addPlaceLink );
       panel.append( "<br>" );
  -    
  -    var addPlaceLink = $( "<a href='#'>" ).text( "Show listed taxa" );
  -    addPlaceLink.on( "click", function( e ) {
  +
  +    addPlaceLink = $( "<a href='#'>" ).text( "Show listed taxa" );
  +    addPlaceLink.on( "click", function ( e ) {
         e.preventDefault( );
         atlasJS.getListings( place );
  -    });
  +    } );
       panel.append( addPlaceLink );
       panel.append( "<br>" );
     }
  -  if( !existing || ( existing.type != "exploded"  && existing.place.admin_level < 20 ) ) {
  +  if ( !existing || ( existing.type !== "exploded" && existing.place.admin_level < <%= Place::COUNTY_LEVEL %> ) ) {
       var explodeLink = $( "<a href='#'>" ).text( "Explode this place" );
  -    explodeLink.on( "click", function( e ) {
  +    explodeLink.on( "click", function ( e ) {
         e.preventDefault( );
         atlasJS.explodePlace( place );
  -    });
  +    } );
       panel.append( explodeLink );
       panel.append( "<br>" );
     }
  -  if( existing && existing.type == "exploded" ) {
  +  if ( existing && existing.type === "exploded" ) {
       var unexplodeLink = $( "<a href='#'>" ).text( "Unexplode this place" );
  -    unexplodeLink.on( "click", function( e ) {
  +    unexplodeLink.on( "click", function ( e ) {
         e.preventDefault( );
         atlasJS.unexplodePlace( place );
  -    });
  +    } );
       panel.append( unexplodeLink );
       panel.append( "<br>" );
     }
  -}
  -
  -atlasJS.bestPlaceForLatLng = function( lat, lng, callback ) {
  +};
  +
  +atlasJS.bestPlaceForLatLng = function ( lat, lng ) {
     atlasJS.removeActivePlaceLayer( );
  -  atlasState.selectedPlaces = [ ];
  -  $.ajax({
  +  atlasState.selectedPlaces = [];
  +  $.ajax( {
       dataType: "json",
       url: "<%= CONFIG.node_api_url %>/places/containing?lat=" + lat + "&lng=" + lng,
  -    success: function( r ) {
  -      var selectedPlaces = [ ];
  +    success: function ( r ) {
  +      var selectedPlaces = [];
         var parentWasNotExploded;
  -      _.each( r.results, function( p ) {
  -        if( !p || !p.geometry_geojson ) { return; }
  -        if( parentWasNotExploded ) { return; }
  +      _.each( r.results, function ( p ) {
  +        if ( !p || !p.geometry_geojson ) { return; }
  +        if ( parentWasNotExploded ) { return; }
           selectedPlaces.push( p );
           var existing = atlasState.placeLayers[p.id];
  -        parentWasNotExploded = !( existing && existing.type == "exploded" );
  -      });
  -      if( selectedPlaces.length == 0 ) { return; }
  +        parentWasNotExploded = !( existing && existing.type === "exploded" );
  +      } );
  +      if ( selectedPlaces.length === 0 ) { return; }
         atlasState.activePlaceLayer = atlasJS.addPlaceToMap(
  -        _.last( selectedPlaces ), null, { selected: true } );
  +        _.last( selectedPlaces ), null, { selected: true }
  +      );
         atlasState.selectedPlaces = selectedPlaces;
         atlasJS.updateMetadataPanel( );
       }
  -  });
  -};
  -
  -atlasJS.addrefreshedPlaces = function( place_hash ) {
  -  var refreshedPlaceIDs = $.map( place_hash, function(v, i){
  -    if( !Object.keys(atlasState.placeLayers).includes(i) || 
  -      ( atlasState.placeLayers[i]["type"] != "native" && 
  -      atlasState.placeLayers[i]["type"] != "introduced" ) ) { return i; }
  -  });
  -  if( refreshedPlaceIDs.length > 0 ) {
  -    $.ajax({
  +  } );
  +};
  +
  +atlasJS.addrefreshedPlaces = function ( placeHash ) {
  +  var refreshedPlaceIDs = $.map( placeHash, function ( v, i ) {
  +    if ( !Object.keys( atlasState.placeLayers ).includes( i ) || (
  +      atlasState.placeLayers[i].type !== "native"
  +        && atlasState.placeLayers[i].type !== "introduced"
  +    ) ) {
  +      return i;
  +    }
  +  } );
  +  if ( refreshedPlaceIDs.length > 0 ) {
  +    $.ajax( {
         dataType: "json",
  -      url: "<%= CONFIG.node_api_url %>/places/" + refreshedPlaceIDs.join(",") + "?per_page=500",
  -      success: function( r ) {
  -        _.each( r.results, function( p ) {
  -          atlasJS.addPlaceToMap( p, place_hash[p.id] );
  -        });
  +      url: "<%= CONFIG.node_api_url %>/places/" + refreshedPlaceIDs.join( "," ) + "?per_page=500",
  +      success: function ( r ) {
  +        _.each( r.results, function ( p ) {
  +          atlasJS.addPlaceToMap( p, placeHash[p.id] );
  +        } );
         }
  -    });
  -  }
  -  $.map( atlasState.placeLayers, function(v, i){
  -    if( !Object.keys(place_hash).includes(i) && 
  -      ( atlasState.placeLayers[i]["type"] == "native" || 
  -      atlasState.placeLayers[i]["type"] == "introduced" ) ) {
  -        atlasState.placeLayers[i].layer.setMap( null );
  -        delete atlasState.placeLayers[i]; 
  -    }
  -  });  
  -};
  -
  -atlasJS.refreshPlaces = function( ) {
  -  $.ajax({
  +    } );
  +  }
  +  $.map( atlasState.placeLayers, function ( v, i ) {
  +    if ( !Object.keys( placeHash ).includes( i ) && (
  +      atlasState.placeLayers[i].type === "native"
  +        || atlasState.placeLayers[i].type === "introduced"
  +    ) ) {
  +      atlasState.placeLayers[i].layer.setMap( null );
  +      delete atlasState.placeLayers[i];
  +    }
  +  } );
  +};
  +
  +atlasJS.refreshPlaces = function ( ) {
  +  $.ajax( {
       dataType: "json",
       url: "/atlases/" + $( "#map" ).data( "atlas-id" ) + ".json",
  -    success: function( r ) {
  +    success: function ( r ) {
         atlasJS.addrefreshedPlaces( r.presence_places );
         atlasState.explodedPlaces = r.exploded_places;
       }
  -  });
  -};
  -
  -atlasJS.showInitialPlaces = function( ) {
  +  } );
  +};
  +
  +atlasJS.showInitialPlaces = function ( ) {
     var initialPlaceIDsWithEstablishment = $( "#map" ).data( "place-ids" );
  -  var initialPlaceIDs = Object.keys(initialPlaceIDsWithEstablishment);
  -  if( initialPlaceIDs.length > 0 ) {
  -    $.ajax({
  +  var initialPlaceIDs = Object.keys( initialPlaceIDsWithEstablishment );
  +  if ( initialPlaceIDs.length > 0 ) {
  +    $.ajax( {
         dataType: "json",
  -      url: "<%= CONFIG.node_api_url %>/places/" + initialPlaceIDs.join(",") + "?per_page=500",
  -      success: function( r ) {
  -        _.each( r.results, function( p ) {
  +      url: "<%= CONFIG.node_api_url %>/places/" + initialPlaceIDs.join( "," ) + "?per_page=500",
  +      success: function ( r ) {
  +        _.each( r.results, function ( p ) {
             atlasJS.addPlaceToMap( p, initialPlaceIDsWithEstablishment[p.id] );
  -        });
  +        } );
         }
  -    });
  -  }
  -
  -  var explodedPlaceIDs = _.map( atlasState.explodedPlaces, function( explodedAtlasPlaceID, placeID ) {
  -    return placeID;
  -  });
  -
  -  if( explodedPlaceIDs.length == 0 ) { return; }
  -  $.ajax({
  -    dataType: "json",
  -    url: "<%= CONFIG.node_api_url %>/places/" + explodedPlaceIDs.join(",") + "?per_page=500",
  -    success: function( r ) {
  -      _.each( r.results, function( p ) {
  +    } );
  +  }
  +
  +  var explodedPlaceIDs = _.map( atlasState.explodedPlaces,
  +    function ( explodedAtlasPlaceID, placeID ) {
  +      return placeID;
  +    } );
  +
  +  if ( explodedPlaceIDs.length === 0 ) { return; }
  +  $.ajax( {
  +    dataType: "json",
  +    url: "<%= CONFIG.node_api_url %>/places/" + explodedPlaceIDs.join( "," ) + "?per_page=500",
  +    success: function ( r ) {
  +      _.each( r.results, function ( p ) {
           atlasJS.addPlaceToMap( p, "exploded" );
  -      });
  -    }
  -  });
  -};
  -
  -atlasJS.alterAtlas = function( place ) {
  -  if( !place ) { return; }
  -  var taxonID = $( "#map" ).data( "taxon-id" );
  -  $.ajax({
  +      } );
  +    }
  +  } );
  +};
  +
  +atlasJS.alterAtlas = function ( place ) {
  +  if ( !place ) { return; }
  +  $.ajax( {
       type: "post",
       dataType: "json",
       url: "/atlases/" + $( "#map" ).data( "atlas-id" ) + "/alter_atlas_presence",
       data: { taxon_id: $( "#map" ).data( "taxon-id" ), place_id: place.id },
  -    success: function( s ) {
  -      if( s.presence ) {
  +    success: function ( s ) {
  +      if ( s.presence ) {
           atlasJS.addPlaceToMap( place,
  -          s.presence == "not allowed" ? "failed" : "native",
  +          s.presence === "not allowed" ? "failed" : "native",
             { selected: true } );
           atlasJS.updateMetadataPanel( );
         } else {
  
positive.code: /* global _ */
  
  var atlasState = {
    map: null,
    selectedPlaces: [ ],
    activePlaceLayer: null,
    placeLayers: { }
  };
  
negative.code:   fillOpacity: 0
  };
  
  atlasJS.clickCallback = function ( e ) {
    atlasJS.bestPlaceForLatLng( e.latLng.lat( ), e.latLng.lng( ) );
  };
  
  atlasJS.removeActivePlaceLayer = function ( ) {
    if ( atlasState.activePlaceLayer ) {
      var existing = atlasState.placeLayers[atlasState.activePlaceLayer.place.id];
      atlasState.activePlaceLayer.layer.setMap( null );
      atlasState.activePlaceLayer = null;
      // layers without types are just selections, not in the atlas
      if ( existing ) {
        if ( existing.type && existing.type !== "pending" ) {
          atlasJS.addPlaceToMap( existing.place, existing.type );
        } else {
          existing.layer.setMap( null );
          delete atlasState.placeLayers[existing.place.id];
        }
      }
    }
  };
  
  atlasJS.addPlaceToMap = function ( p, type, options ) {
    options = options || { };
    if ( !p || !p.geometry_geojson ) { return; }
    // remove any versions of this place already stored
    var existingPlaceLayer = atlasState.placeLayers[p.id];
    var isSelection = options.selected;
    if ( existingPlaceLayer && isSelection && !type ) {
      type = existingPlaceLayer.type;
    }
    if ( atlasState.placeLayers[p.id] ) {
      atlasState.placeLayers[p.id].layer.setMap( null );
      delete atlasState.placeLayers[p.id];
    }
  
    var style;
    if ( type === "native" ) {
      style = atlasJS.nativeStyle;
    } else if ( type === "introduced" ) {
      style = atlasJS.introducedStyle;
    } else if ( type === "exploded" ) {
      style = atlasJS.explodedStyle;
    } else if ( type === "failed" ) {
      style = atlasJS.failedStyle;
    } else {
      style = atlasJS.pendingStyle;
    }
  
    if ( isSelection ) {
      style = _.assign( { }, style, {
        strokeWeight: 5
      } );
    }
  
  
    var layer = new google.maps.Data( { style: style } );
    layer.addGeoJson( {
      type: "Feature",
      geometry: p.geometry_geojson
    } );
    if ( $( "#map" ).data( "is-curator" ) ) {
      // layers need the same click actions as map, because layers are on top
      layer.addListener( "click", atlasJS.clickCallback );
    }
  