Much BIG commit

Bugfixes, a whole bunch of changes and some comments of how everything
works.