code cleanup stage 2.