Fixed corpus.py
Fixed bug in corpus
Optimization and some convenience