private Map<String, String> generate(boolean finish) {
        Map<String, String> vars = new LinkedHashMap<String, String>();
        Double percent = Double.valueOf(0);

        if (max > 0) {
            percent = round((double) current / max, 1);
        }

        if (formatVars.containsKey("bar")) {
            int completeBars;

            if (max > 0) {
                completeBars = Double.valueOf(Math.floor(percent * barWidth)).intValue();
            } else {
                completeBars = finish ? barWidth : Double.valueOf(Math.floor(current % barWidth)).intValue();
            }

            int emptyBars = barWidth - completeBars - progressChar.length();
            String bar = repeat(barChar, completeBars);
            if (completeBars < barWidth) {
                bar += progressChar;
                bar += repeat(emptyBarChar, emptyBars);
            }

            vars.put("bar", bar);
        }

        if (formatVars.containsKey("elapsed")) {
            long elapsed = System.currentTimeMillis() - startTime;
            vars.put("elapsed", leftPad(humaneTime(elapsed), widths.get("elapsed"), " "));
        }

        if (formatVars.containsKey("current")) {
            vars.put("current", leftPad(String.valueOf(current), widths.get("current"), " "));
        }

        if (formatVars.containsKey("max")) {
            vars.put("max", String.valueOf(max));
        }

        if (formatVars.containsKey("percent")) {
            vars.put("percent", leftPad(String.valueOf(new Double(percent * 100).intValue()), widths.get("percent"), " "));
        }

        return vars;
    }