 		'SELECT project_id, activity_id, location_id, start_date, end_date, x, y, georef, array_agg(distinct taxonomy_id) as taxonomy_ids, array_agg(distinct classification_id) as classification_ids, array_agg(distinct organization_id) as organization_ids ' ||
 		'FROM taxonomy_lookup ' ||
 		'GROUP BY project_id, activity_id, location_id, start_date, end_date, x, y, georef';
-		
+
 	EXECUTE 'UPDATE location_lookup SET gaul0_name = lbf.name FROM location_boundary_features lbf WHERE location_lookup.location_id = lbf.location_id AND lbf.boundary_id = 1;';
 	EXECUTE 'UPDATE location_lookup SET gaul1_name = lbf.name FROM location_boundary_features lbf WHERE location_lookup.location_id = lbf.location_id AND lbf.boundary_id = 2;';
 	EXECUTE 'UPDATE location_lookup SET gaul2_name = lbf.name FROM location_boundary_features lbf WHERE location_lookup.location_id = lbf.location_id AND lbf.boundary_id = 3;';
 
 	EXECUTE 'TRUNCATE TABLE organization_lookup';
 
-	EXECUTE 'INSERT INTO organization_lookup(project_id, activity_id, organization_id, taxonomy_ids,classification_ids,location_ids) ' ||
-		'SELECT project_id, activity_id, organization_id, array_agg(distinct taxonomy_id) as taxonomy_ids, array_agg(distinct classification_id) as classification_ids, array_agg(distinct location_id) as location_ids ' ||
+	EXECUTE 'INSERT INTO organization_lookup(project_id, activity_id, organization_id, start_date, end_date, taxonomy_ids,classification_ids,location_ids) ' ||
+		'SELECT project_id, activity_id, organization_id, start_date, end_date, array_agg(distinct taxonomy_id) as taxonomy_ids, array_agg(distinct classification_id) as classification_ids, array_agg(distinct location_id) as location_ids ' ||
 		'FROM taxonomy_lookup  ' ||
-		'GROUP BY project_id, activity_id, organization_id';
+		'GROUP BY project_id, activity_id, organization_id, start_date, end_date';
 
 	
     RAISE NOTICE 'Done refreshing taxonomy_lookup.';

      END IF;
    END IF;				 

    execute_statement := execute_statement || ') p left join ' ||
			-- participants (Accountable)
			'(select pp.project_id, array_to_string(array_agg(distinct o.name), '','') as orgs from participation pp join organization o on pp.organization_id = o.organization_id ' ||
			'left join participation_taxonomy ppt on pp.participation_id = ppt.participation_id join classification c on ppt.classification_id = c.classification_id ' ||

);
-- add the current configuration information
INSERT INTO config(version, iteration, changeset, download_dir) 
VALUES (2.0, 7, 4, '/var/lib/postgresql/9.3/main/');
--Contact
CREATE TABLE "contact"
(
