public static void main(String[] args) throws IOException {
		// Load database
		System.out.println("Loading database...");
		database = DatabaseLoader.load();
		if (database == null) {
			System.out.println("Error loading database. Exiting.");
			return;
		}
		System.out.println("Load complete. Found " + database.size() + " records.");

		// Scan database, storing list of groups and nutrients
		for (FoodItem f : database) {
			for (FoodItem.Nutrient n : f.nutrients) {
				if (!nutrients.contains(n)) nutrients.add(n);
			}
			if (!groups.contains(f.group)) groups.add(f.group);
		}

		// Sort groups and nutrients alphabetically
		nutrients = Utilities.sortNutrientList(nutrients);
		groups = Utilities.sortGroupList(groups);

		// Load default nutrient indexes
		for (int currentDisplayedNutrientIndex = 0; currentDisplayedNutrientIndex < displayedNutrients.length; currentDisplayedNutrientIndex++) {
			for (int currentNutrientIndex = 0; currentNutrientIndex < nutrients.size(); currentNutrientIndex++) {
				if (nutrients.get(currentNutrientIndex).description.equalsIgnoreCase(DEFAULT_DISPLAYED_NUTRIENTS[currentDisplayedNutrientIndex])) {
					displayedNutrients[currentDisplayedNutrientIndex] = currentNutrientIndex;
					break;
				}
			}
		}

		System.out.println("Found " + database.size() + " foods in " + groups.size() + " groups containing " + nutrients.size() + " nutrients.");

		// Start web server
		HttpServer server = HttpServer.create(new InetSocketAddress(PORT), 0);
		HttpContext context = server.createContext("/", new PageHandler());
		context.getFilters().add(new ParameterFilter());
		server.setExecutor(null);
		server.start();
		System.out.println("Started server at http://localhost:" + PORT + ".");
	}