Code reorganization to speedup startup and maintenance