public static Deck readDeck(File deckFile) {

        List<String> lines = new LinkedList<String>();

        try {
            BufferedReader r = new BufferedReader(new FileReader(deckFile));

            String line;
            while ((line = r.readLine()) != null) {
                lines.add(line);
            }

            r.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        ListIterator<String> lineIterator = lines.listIterator();

        String line = lineIterator.next();

        //Old text-based format
        if (!line.equals("[metadata]")) {
            lineIterator.previous();
            return readDeckOld(lineIterator);
        }

        Deck d = new Deck();

        //read metadata
        while (!(line = lineIterator.next()).equals("[main]")) {
            String[] linedata = line.split("=", 2);
            d.addMetaData(linedata[0], linedata[1]);
        }

        addCardList(lineIterator, d);

        return d;

    }