Optimization for dictionary