major code cleanup - no functional changes