did some refactoring to prepare for lucene 4.0