Add optimizations to symbolic expression of D