cleanup before reorganizing code