rewriting gensim part