Begun preparation for introducing GUI.
- also added a few docstrings