Fixed major bugs in corpus_builder and added a feature to priint out codes list to a different file