Refactor DocumentSource to Corpus and making it more Robust