Lots of bugfixes, some formatting issues.