Fixes as described in latest Review document

In addition to creating a new review based on the current state of the code, which is available at ``docs/review.txt``, I fixed most of the found issues directly.

This branch/PR contains all the different fixes, which were applied during the creation of the Review document. All fixed issues within this branch are marked inside the review document (using **FIXED** annotation).

The commits should be atomic enough to be easily cherry-pickable, if not all changes are transferred over.