worked with optimizing code