commented all functions in sim.py with docstrings