Code cleanup after major reorganization