Fully documented first draft

Doesn’t yet work fully, but it should (only debugging left).
Also, script is now fully documented.