optimizing merged code