optimizing code part1