Since getFileIndex returns an integer, we don't need to parseInt anymore. And be careful to handle the case of -1 or file not found case. That shouldn't be. Once found the case of -1, we should discard the event in this case.