Bugfixes and Cosmetic Changes

Very slight cosmetic changes.

Several small bugfixes.