Added some code from Gensim, to maybe help with ideas for improving throughput..