functionalized simulation.py