Code reorganization, cleanup.