Various code cleanup.