Optimizing the codes