Initial pass at code cleanup.