Code reorganization/cleanup