Refactor GenerateChain.py to increase performance, especially with extremely large dictionaries, and to make it modular so that it can be used in other python scripts