formatting fixes and minor code cleanups.