    public synchronized void populateQuestions() {
        Logger.d(TAG, "Populating poll");
        int nSlots = questionsStorage.getNSlotsPerPoll();
        HashMap<Integer, ArrayList<Question>> slots =
                new HashMap<Integer, ArrayList<Question>>();
        SlottedQuestions slottedQuestions =
                questionsStorage.getSlottedQuestions();
        Logger.v(TAG, "Got {} questions from DB", slottedQuestions.size());
        HashMap<Integer, ArrayList<Question>> positionedGroups =
                slottedQuestions.getPositionedQuestionGroups();
        Logger.v(TAG, "Got {} positioned question groups",
                positionedGroups.size());
        int originalIndex;
        int convertedIndex;
        for (Map.Entry<Integer, ArrayList<Question>> groupEntry :
                positionedGroups.entrySet()) {
            originalIndex = groupEntry.getKey();
            convertedIndex = originalIndex < 0 ?
                    nSlots + originalIndex : originalIndex;
            Logger.v(TAG, "Placing group at slot {}", convertedIndex);
            slots.put(convertedIndex, groupEntry.getValue());
        }
        ArrayList<Integer> remainingIndices = new ArrayList<Integer>();
        for (int i = 0; i < nSlots; i++) {
            if (!slots.containsKey(i)) {
                remainingIndices.add(i);
            }
        }
        int nFloatingToFill = remainingIndices.size();
        Logger.v(TAG, "Still have {} slots to fill", nFloatingToFill);
        ArrayList<ArrayList<Question>> floatingGroups =
                slottedQuestions.getRandomFloatingQuestionGroups(
                        nFloatingToFill);
        Logger.v(TAG, "Got {} floating groups to fill the slots",
                floatingGroups.size());
        for (int i = 0; i < nFloatingToFill; i++) {
            Logger.v(TAG, "Putting group {0} at slot {1}",
                    floatingGroups.get(i).get(0).getSlot(),
                    remainingIndices.get(i));
            slots.put(remainingIndices.get(i), floatingGroups.get(i));
        }
        ArrayList<ArrayList<Question>> slotsArray =
                new ArrayList<ArrayList<Question>>(nSlots);
        ArrayList<Question> slotQuestions;
        for (Map.Entry<Integer, ArrayList<Question>> groupEntry :
                slots.entrySet()) {
            Logger.v(TAG, "Shuffling slot {}", groupEntry.getKey());
            slotQuestions = groupEntry.getValue();
            util.shuffle(slotQuestions);
            slotsArray.add(groupEntry.getKey(), slotQuestions);
        }
        Logger.v(TAG, "Flattening the slots into an array");
        questions = new ArrayList<Question>();
        for (ArrayList<Question> slot : slotsArray) {
            questions.addAll(slot);
        }
    }

    public synchronized void populateQuestions() {
        Logger.d(TAG, "Populating poll");
        int nSlots = questionsStorage.getNSlotsPerPoll();
        HashMap<Integer, ArrayList<Question>> slots =
                new HashMap<Integer, ArrayList<Question>>();
        SlottedQuestions slottedQuestions =
                questionsStorage.getSlottedQuestions();
        Logger.v(TAG, "Got {} questions from DB", slottedQuestions.size());
        HashMap<Integer, ArrayList<Question>> positionedGroups =
                slottedQuestions.getPositionedQuestionGroups();
        Logger.v(TAG, "Got {} positioned question groups",
                positionedGroups.size());
        int originalIndex;
        int convertedIndex;
        for (Map.Entry<Integer, ArrayList<Question>> groupEntry :
                positionedGroups.entrySet()) {
            originalIndex = groupEntry.getKey();
            convertedIndex = originalIndex < 0 ?
                    nSlots + originalIndex : originalIndex;
            Logger.v(TAG, "Placing group at slot {}", convertedIndex);
            slots.put(convertedIndex, groupEntry.getValue());
        }
        ArrayList<Integer> remainingIndices = new ArrayList<Integer>();
        for (int i = 0; i < nSlots; i++) {
            if (!slots.containsKey(i)) {
                remainingIndices.add(i);
            }
        }
        int nFloatingToFill = remainingIndices.size();
        Logger.v(TAG, "Still have {} slots to fill", nFloatingToFill);
        ArrayList<ArrayList<Question>> floatingGroups =
                slottedQuestions.getRandomFloatingQuestionGroups(
                        nFloatingToFill);
        Logger.v(TAG, "Got {} floating groups to fill the slots",
                floatingGroups.size());
        for (int i = 0; i < nFloatingToFill; i++) {
            Logger.v(TAG, "Putting group {0} at slot {1}",
                    floatingGroups.get(i).get(0).getSlot(),
                    remainingIndices.get(i));
            slots.put(remainingIndices.get(i), floatingGroups.get(i));
        }
        ArrayList<ArrayList<Question>> slotsArray =
                new ArrayList<ArrayList<Question>>(nSlots);
        ArrayList<Question> slotQuestions;
        for (Map.Entry<Integer, ArrayList<Question>> groupEntry :
                slots.entrySet()) {
            Logger.v(TAG, "Shuffling slot {}", groupEntry.getKey());
            slotQuestions = groupEntry.getValue();
            util.shuffle(slotQuestions);
            slotsArray.add(groupEntry.getKey(), slotQuestions);
        }
        Logger.v(TAG, "Flattening the slots into an array");
        questions = new ArrayList<Question>();
        for (ArrayList<Question> slot : slotsArray) {
            for (Question q : slot) {
                addQuestion(q);
            }
        }
    }
