private synchronized Map<String, HashMap<String, Queue<Integer>>> createInvertedIndex() {
		Map<String,HashMap<String,Queue<Integer>>> myMap = new HashMap<String, HashMap<String, Queue<Integer>>>();
		File resources = new File("resources");
		BufferedReader br = null;
		for (File inputFile : resources.listFiles()) {
			String filename = inputFile.getName();
			int wordCount = 0;
			logger.debug("File: " + inputFile.getName());
			try {
				br = new BufferedReader(new FileReader(inputFile));
				String line = "";
				while ((line = br.readLine()) != null) {
					// get only words, remove all special characters
					String words[] = line.toLowerCase().split("\\W+");
					for (String word : words) {
						HashMap<String, Queue<Integer>> childMap;
						Queue<Integer> positions;
						wordCount++;
						// check if word exists
						if (myMap.containsKey(word)) {
							// get childmap
							childMap = myMap.get(word);
							// check if entry for file exists
							if (childMap.containsKey(filename)) {
								// add position for the word
								positions = childMap.get(filename);
							}else{
								positions = new LinkedList<Integer>();
							}
						} else {
							childMap = new HashMap<String, Queue<Integer>>();
							positions = new LinkedList<Integer>();
						}
						positions.add(wordCount);
						childMap.put(filename, positions);
						myMap.put(word, childMap);
					}
				}
			} catch (Exception e) {
				logger.error("error", e);
			} finally {
				try {
					br.close();
				} catch (IOException e) {
					logger.error(e);
				}
			}
		}
		logger.info("Inverted index built successfully");
		return myMap;

	}