Dictionary optimization