Minor code cleanup and tweaks.