First pass at code cleanup.