@SuppressWarnings("unchecked")
  public void captures() {
    if (match == null) {
      return;
    }
    capture.clear();

    // _capture.put("LINE", this.line);
    // _capture.put("LENGTH", this.line.length() +"");

    Map<String, String> mappedw = GrokUtils.namedGroups(this.match,this.subject);
    Iterator<Entry<String, String>> it = mappedw.entrySet().iterator();
    while (it.hasNext()) {

      @SuppressWarnings("rawtypes")
      Map.Entry pairs = (Map.Entry) it.next();
      String key = null;
      Object value = null;
      if (this.grok.getNamedRegexCollectionById(pairs.getKey().toString()) == null) {
        key = pairs.getKey().toString();
      } else if (!this.grok.getNamedRegexCollectionById(pairs.getKey().toString()).isEmpty()) {
        key = this.grok.getNamedRegexCollectionById(pairs.getKey().toString());
      }
      if (pairs.getValue() != null) {
        value = pairs.getValue().toString();

        KeyValue keyValue = Converter.convert(key, value);

        // get validated key
        key = keyValue.getKey();

        // resolve value
        if (keyValue.getValue() instanceof String) {
          value = cleanString((String) keyValue.getValue());
        } else {
          value = keyValue.getValue();
        }

        // set if grok failure
        if (keyValue.hasGrokFailure()) {
          capture.put(key + "_grokfailure", keyValue.getGrokFailure());
        }
      }

      if (capture.containsKey(key)) {
    	Object currentValue = capture.get(key);
    	if(currentValue instanceof List) {
          ((List<Object>) currentValue).add(value);
    	} else {
    	  List<Object> list = new ArrayList<Object>();
    	  list.add(currentValue);
    	  list.add(value);
    	  capture.put(key, list);
    	}
      } else {
    	capture.put(key, value);
      }
      
      it.remove(); // avoids a ConcurrentModificationException
    }
  }