do some optimization to cms