Various style and code cleanups