Add define optimization
Merge branch 'RewriteMap'