Added some docstrings. Minor restructuring.
Refactored repetitive run-generating code