public void updateUsks(PrintStream out) throws IOException, InterruptedException {
        out.println("----------------------------------------");
        out.println("Finding USKs...");
        out.println("----------------------------------------");

        Map<String, Integer> latest = new HashMap<String, Integer>();
        for (String pageName : mOverlay.getNames()) {
            Matcher matcher = USK_REGEX.matcher(mOverlay.getPage(pageName));
            int count = 0;
            while (matcher.find()) {
                if (count == 0) {
                    out.println("[" + pageName +"]");
                }
                out.println(matcher.group());
                int index = Integer.parseInt(matcher.group(3));
                if (latest.get(matcher.group(2)) == null ||
                    latest.get(matcher.group(2)) < index) {
                    latest.put(matcher.group(2), index);
                }
                count++;
            }
        }

        out.println("----------------------------------------");
        out.println("Looking up latest versions...");
        out.println("----------------------------------------");

        FcpTools runner = new  FcpTools(mFcpHost, mFcpPort, "jfniki");

        FcpTools.setDebugOutput(out);
        for (Map.Entry<String, Integer> entry : latest.entrySet()) {
            String usk = String.format("%s%d/", entry.getKey(), entry.getValue());
            FcpTools.CheckUsk cmd = runner.sendCheckUsk(usk);
            runner.waitUntilAllFinished();

            if (!cmd.getUri().equals(usk)) {
                String[] fields = cmd.getUri().split("/");
                latest.put(entry.getKey(),
                           Integer.parseInt(fields[fields.length -1]));
            }
        }

        out.println("----------------------------------------");
        out.println("Fixing pages...");
        out.println("----------------------------------------");
        for (String pageName : mOverlay.getNames()) {
            updateUsksOnPage(latest, pageName, out);
        }
    }