Optimize block code