Code cleanup and some style fixes.