optimizing contractions