Added some optimization to CPS.