LUCENE-4956: Remove stuff not really needed. TODO: add attribution, because this code is borrowed, too!