Some code cleanup and cosmetic improvements.