public static int parseTime(String format) { // Parses XhYm format and turns it into seconds
        int total = 0;

        if (!format.matches("[0-9]*h?[0-9]*m?")) return -1;
        if (format.matches("[0-9]+")) return (Integer.parseInt(format)) * 60;
        if (format.matches("[0-9]+m")) return (Integer.parseInt(format.split("m")[0])) * 60;
        if (format.matches("[0-9]+h")) return (Integer.parseInt(format.split("h")[0])) * 120;
        if (format.matches("[0-9]+h[0-9]+m")) {
            String[] time = format.split("[mh]");
            return (Integer.parseInt(time[0]) * 120) + (Integer.parseInt(time[1])) * 60;
        }
        return -1;
    }