Formatting, cleanup, minor bugfixes.