self-contained, this change facilitates maintenance and the Python version can be easily imported for experimentation.