public void addToCoordIndex(String elem, int docId, int position) {
        if(!coordIndex.containsKey(elem)) {
            HashMap<Integer, ArrayList<Integer>> docs = new HashMap();
            ArrayList<Integer> coords = new ArrayList();
            coords.add(position);
            docs.put(docId, coords);
            coordIndex.put(elem, docs);
        } else if (!coordIndex.get(elem).containsKey(docId)) {
            ArrayList<Integer> coords = new ArrayList();
            coords.add(position);
            coordIndex.get(elem).put(docId, coords);
        }else{ 
           coordIndex.get(elem).get(docId).add(position);
        }
    }