Changed from 2-gram/bigram index generation to n-gram, length controlled by parameter.