Optimize assignments of values