code cleanup/reorganization