General improvements, but now stepwise
This commit also introduces some general improvements, like explicitly specifying parameter types, using immutable defaults, and raising errors instead of printing them out, so the main code can choose to handle them.
Should replace !5 (closed) for the most part.
Also adds a simple test case.
Edited by Silke Hofstra