optimizes some code